<?php
/* -----------------------------------------------------------------
* 	ID:						$Id: cseo_get_content.inc.php 2 2011-02-17 13:35:25Z akausch $
* 	Letzter Stand:			$Revision: 2 $
* 	zuletzt geändert von: 	$Author: akausch $
* 	Datum:					$Date: 2011-02-17 14:35:25 +0100 (Do, 17. Feb 2011) $
*
* 	commerce:SEO by Webdesign Erfurt
* 	http://www.commerce-seo.de
*
* 	Copyright (c) since 2010 commerce:SEO
* ------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* --------------------------------------------------------------- */

function cseo_get_content($flag) {

	if(GROUP_CHECK == 'true')
		$group_check = "and group_ids LIKE '%c_".$_SESSION['customers_status']['customers_status_id']."_group%'";

	$content_data = xtDBquery("SELECT
										content_id,
										categories_id,
										parent_id,
										content_title,
										content_out_link,
										content_link_target,
										content_link_type,
										content_group
									FROM
										".TABLE_CONTENT_MANAGER."
									WHERE
										languages_id='".(int) $_SESSION['languages_id']."'
									AND
										parent_id = '0'
									AND
										file_flag = '".$flag."'
										".$group_check."
									AND
										content_status = '1'
									ORDER BY
										sort_order");

	$content_string = '<ul>';
	while($content_data_while = xtc_db_fetch_array($content_data,true)) {
		if($content_data_while['content_out_link'])
			$content_string .= '<li class="list"><a title="'.$content_data_while['content_title'].'" rel="'.$content_data_while->fields['content_link_type'].'" target="'.$content_data_while->fields['content_link_target'].'" href="'.$content_data_while->fields['content_out_link'].'">'.$content_data_while->fields['content_title'].'</a>';
		else
			$content_string .= '<li class="list"><a title="'.$content_data_while['content_title'].'" href="'.xtc_href_link(FILENAME_CONTENT, 'coID='.$content_data_while->fields['content_group']).'">'.$content_data_while->fields['content_title'].'</a>';

		if($_GET['coID'] == $content_data_while->fields['content_group']) {
			$get_child = cseo_get_content_child($content_data_while->fields['content_group'], $flag);
			if(is_array($get_child)){
				$content_string .= '<ul class="sub">';
				foreach($get_child AS $child_data){
					if($child_data['content_out_link'])
						$content_string .= '<li><a title="'.$child_data['content_title'].'" rel="'.$child_data['content_link_target'].'" target="'.$child_data['content_link_type'].'" href="'.$child_data['content_out_link'].'">'.$child_data['content_title'].'</a></li>';
					else
						$content_string .= '<li><a title="'.$child_data['content_title'].'" href="'.xtc_href_link(FILENAME_CONTENT, 'coID='.$child_data['content_group']).'">'.$child_data['content_title'].'</a></li>';
				}
				$content_string .= '</ul>';
			}
		}
		$content_string .= '</li>';
	}
	$content_string .= '</ul>';
	return $content_string;
}
?>